﻿/**
 * @file mainwindow.h
 * @author huangxb
 * @email 18228033207@163.com
 * @date 2025-04-08
 * @brief 主窗口视图
 */
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

namespace Ui {
class MainWindow;
}
class CMainController;
class QTreeView;
class QSplitter;

/** @brief 主窗口. */
class MainWindow
    : public QMainWindow
{
    Q_OBJECT

private:
    enum TreeColumn
    {
        Column_Name = 0,
    };
    enum TreeDataRole
    {
        DataRole_Component = Qt::UserRole + 1,
    };
    enum ComponentType
    {
        Component_Buttons = 0,
    };

    Ui::MainWindow *ui = nullptr;
    QSplitter* m_pSplitter = nullptr;
    CMainController* m_pController = nullptr;
    QTreeView* m_pComponentTreeView = nullptr;
    QWidget* m_pEmptyView = nullptr;

public:
    MainWindow(QWidget *parent = nullptr);
    virtual ~MainWindow();

    void SetController(CMainController* pController);
    void ShowComponentView(QWidget* pView);

private slots:
    /* File action */

    /* Help action */

    /* tree action*/
    void OnComponentTreeDoubleClicked(const QModelIndex& index);

private:
    void SetupUI();
    void UpdateUI();
};
#endif // MAINWINDOW_H
